stage.create_grid_overlay(50, 'greenyellow')
size = .3
planet = codesters.Sprite("mars", -200, -200)
planet.set_size(.4)
stage.set_background("space")
sprite = codesters.Sprite("ufo")
sprite.set_size(0.4)
sprite.go_to(-100, -50)
t = codesters.Teacher()
try:
tval1 = stage.get_name()
except:
tval1 = "DNE"
try:
tval2 = int(t.get_parameters_for_function('go_to')[0][0])
tval3 = int(t.get_parameters_for_function('go_to')[0][1])
except:
tval2 = "DNE"
tval3 = "DNE"
t1 = TestObjective()
t1.add_success(tval2 == -200 and tval3 == -200, "Great job!")
t1.add_failure(tval2 == "DNE", "Oops! Did you delete your Go To command?")
t1.add_failure(tval2 == -100, "Did you change the x-coordinate?")
t1.add_failure(tval3 == -50, "Did you change the y-coordinate?")
t1.add_creative(tval2 != -200 and tval2 != "DNE" and tval3 != -200, "That's a good place for your sprite, too!")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)